﻿<UserControl x:Class="Mengsk.Device.Buses.UI.BusMonitorUC"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded">
    <ListBox Name="lstBuses">
        <ListBox.ItemContainerStyle>
            <Style TargetType="ListBoxItem">
                <Setter  Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Grid Background="{Binding Background}">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition MinWidth="100"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Bus.Info.ReadableValue}" Margin="3" VerticalAlignment="Center"/>
                                <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding State}" Margin="3" VerticalAlignment="Center"/>
                                <TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding Message}" Margin="3" VerticalAlignment="Center"/>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ListBox.ItemContainerStyle>
    </ListBox>
</UserControl>
